Dynomotion

Group: DynoMotion Message: 10839 From: jackgiz@ymail.com Date: 1/15/2015
Subject: Random noise stopping machine?
Tom,
Every once in a while, usually after I’m into a Gcode program 10 or 15 minutes my machine stops, the DRO’s turn yellow and my router stops.  This is exactly the result I have programmed into my init file for when I hit the Estop button.  I commented out the Estop code and the problem has gone away but I have no Estop.  I’ve got my Estop wired normally closed so that if there is a broken wire on my Estop circuit the machine will not start.  I’ve checked the wire and connections and cannot find any indication of a break.  I think what might be happening is the Estop switch contacts may be a little oxidized and are causing a very brief lack of continuity because of vibration.  I was thinking of adding a debounce line of code to my Estop code so that this “noise” could be filtered out but I can’t find anything on Debounce and how it should be formatted .  Can you get me pointed in the right direction?  Here is my Estop code:

        //this is a continuous loop that checks the ESTOP bit and
        //disables all Axis
        while(ReadBit(ESTOP)!=1)     // loop until Limit bit goes to specified polarity
        WaitNextTimeSlice();

            DisableAxis(0); //Stop X
            DisableAxis(1); //Stop Y
            SetBit(0); // set bit to a 1 (which turns router off)
            Move (2,-3000);    // raise bit to just under soft limit
            DisableAxis(2);    // Stop Z and survey the damage
        return 0;

Also, my move command doesn’t work.  Should I be using Moray’s ch0->Position = 5000 format instead?

Jack


Group: DynoMotion Message: 10850 From: Tom Kerekes Date: 1/17/2015
Subject: Re: Random noise stopping machine?
Hi Jack,

The ExternalButtons.c example has a Debounce function that you might use.  The Debounce function is written to be "nonblocking" in addition to performing debouncing.  The way you wrote your code is fine but while it is waiting for ESTOP it can't do anything else.  The Debounce function maintains it state in 3 supplied variables so it can exit and come back later and resume what it was doing.  This facilitates doing multiple things in one loop with one Thread.  The Debounce function also tells you when the signal changes rather than just the high/low level.  It returns 1 when it changes high, 0 when it changes low, and -1 when it hasn't changed.

You might also try a hardware solution like a 0.1uF ceramic capacitor from the input to GND right near KFLOP to filter out Noise and require the switch to open for some time before going high.

You might also describe how things are wired and which IO you are using.

The Move command doesn't work because you are disabling the axis immediately after the move begins.  A Move() command only initiates the motion.  To wait until the axis has completed the motion loop waiting on CheckDone() such as:

while (!CheckDone(2))  ;   // loop doing nothing until the motion completes

HTH
Regards
TK